% 
% @(#)Real.m	1.2  6/29/87
%
export _RealObject to "Builtins"

const _RealObject == immutable object _RealObject
  export getSignature, create
  const RealType == immutable type RealType
    function + [o : Real] -> [r : Real]
      % r <- self + o
    function - [o : Real] -> [r : Real]
      % r <- self - o
    function * [o : Real] -> [r : Real]
      % r <- self * o
    function / [o : Real] -> [r : Real]
      % r <- self / o
    function > [o : Real] -> [r : Boolean]
      % r <- self > o
    function >= [o : Real] -> [r : Boolean]
      % r <- self >= o
    function < [o : Real] -> [r : Boolean]
      % r <- self < o
    function <= [o : Real] -> [r : Boolean]
      % r <- self <= o
    function = [o : Real] -> [r : Boolean]
      % r <- self = o
    function != [o : Real] -> [r : Boolean]
      % r <- self != o
    function asString -> [r : String]
      % s is set to a string with no leading 0's, decimal rep.
    function asInteger -> [r : Integer]
      % s is set to an integer (rounded)
    function ~ -> [r : Real]
      % r <- negate self
  end RealType
  function getSignature -> [result : Signature]
    result <- RealType
  end getSignature
  function create [rep : String] -> [result : RealType]
    result <- immutable object aReal
      export +, -, *, /, >, >=, <, <=, =, !=, asString, asInteger, ~
      function + [o : Real] -> [r : Real]
	primitive 010 [r] <- [o]
      end +
      function - [o : Real] -> [r : Real]
	primitive 110 [r] <- [o]
      end -
      function * [o : Real] -> [r : Real]
	primitive 210 [r] <- [o]
      end *
      function / [o : Real] -> [r : Real]
	primitive 310 [r] <- [o]
      end /
      function > [o : Real] -> [r : Boolean]
	primitive 510 [r] <- [o]
      end >
      function >= [o : Real] -> [r : Boolean]
	primitive 610 [r] <- [o]
      end >=
      function < [o : Real] -> [r : Boolean]
	primitive 710 [r] <- [o]
      end <
      function <= [o : Real] -> [r : Boolean]
	primitive 810 [r] <- [o]
      end <=
      function = [o : Real] -> [r : Boolean]
	primitive 910 [r] <- [o]
      end =
      function != [o : Real] -> [r : Boolean]
	primitive 1010 [r] <- [o]
      end !=
      function asString -> [r : String]
	primitive 1110 [r] <- []
      end asString
      function asInteger -> [r : Integer]
	primitive 1210 [r] <- []
      end asInteger
      function ~ -> [r : Real]
	primitive 1310 [r] <- []
      end ~
    end aReal
  end create
end _RealObject
